package energyDown.gui;

import energyDown.modelo.Cenario;
import java.text.DecimalFormat;

/**
 *
 * @author Ana Meireles
 */
public class PainelStatusCenarios extends javax.swing.JPanel {

    private Cenario cenario;
    private DecimalFormat fmt = new DecimalFormat("#,##0.00");

    /**
     * Creates new form PainelStatusCenario
     */
    public PainelStatusCenarios() {
        initComponents();
    }

    public void setCenario(Cenario cenario) {
        this.cenario = cenario;
        atualizar();
    }

    public void atualizar() {
        txtMesAtual.setText(String.valueOf(cenario.getMesAtual()));
        txtConsumoAtual.setText(fmt.format(cenario.getUltimoConsumo()));
        txtDespesaAtual.setText(fmt.format(cenario.getUltimaDespesa()));
        txtMetaDespesa.setText(fmt.format(cenario.getMetaDespesa()));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtConsumoAtual = new javax.swing.JTextField();
        txtDespesaAtual = new javax.swing.JTextField();
        txtMetaDespesa = new javax.swing.JTextField();
        txtMesAtual = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtMetaDespesa1 = new javax.swing.JTextField();

        jLabel1.setText("Mês atual");

        jLabel2.setText("Consumo Atual (KWh)");

        jLabel3.setText("Despesa Atual (R$)");

        jLabel4.setText("Meta Despesa (R$)");

        txtConsumoAtual.setEditable(false);
        txtConsumoAtual.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        txtDespesaAtual.setEditable(false);
        txtDespesaAtual.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        txtMetaDespesa.setEditable(false);
        txtMetaDespesa.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        txtMesAtual.setEditable(false);
        txtMesAtual.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jLabel5.setText("Orçamento (R$)");

        txtMetaDespesa1.setEditable(false);
        txtMetaDespesa1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel1)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtConsumoAtual)
                    .addComponent(txtDespesaAtual)
                    .addComponent(txtMetaDespesa, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)
                    .addComponent(txtMesAtual)
                    .addComponent(txtMetaDespesa1))
                .addContainerGap(23, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtMesAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtConsumoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtDespesaAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtMetaDespesa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtMetaDespesa1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JTextField txtConsumoAtual;
    private javax.swing.JTextField txtDespesaAtual;
    private javax.swing.JTextField txtMesAtual;
    private javax.swing.JTextField txtMetaDespesa;
    private javax.swing.JTextField txtMetaDespesa1;
    // End of variables declaration//GEN-END:variables
}
